package org.ccay.excel.importer.validate.impl;

import org.ccay.core.util.StringUtil;
import org.ccay.excel.importer.validate.AbstractValidator;
import org.ccay.excel.importer.validate.IStatus;

/**
 * 非空校验器。
 * 
 * @author chaowangbang
 * @since Mar 27, 2012
 */
public class RequiredValidator extends AbstractValidator {
	
	public static final String MESSAGE_KEY = "ccay.excel.validate.required.error";

	/* (non-Javadoc)
	 * @see org.ccay.excel.importer.validate.IValidator#validate(java.lang.String, org.ccay.excel.importer.validate.IValidationContext)
	 */
	public IStatus doValidate(Object value) {
		if(value!=null && !StringUtil.isNullOrEmpty(value.toString().trim())) {
			return IStatus.Ok;
		}
		
		return error();
	}

}
